package com.peress.mycrew.rowing.util;

import java.util.HashMap;
import java.util.Map;

public final class Objects {

    public static class StringHelper {
        private final String mTitle;
        private final HashMap<String, Object> mMap;

        public StringHelper(String title) {
            mTitle = title;
            mMap = new HashMap<>();
        }

        public StringHelper add(String key, Object value) {
            mMap.put(key, value);
            return this;
        }

        @Override
        public String toString() {
            StringBuilder sb = new StringBuilder(mTitle).append(" { ");
            for (Map.Entry<String, Object> entry : mMap.entrySet()) {
                if (sb.length() != 0) {
                    sb.append(", ");
                }
                sb.append(entry.getKey()).append("=").append(entry.getValue());
            }
            return sb.append(" }").toString();
        }
    }
}
